<%--
  Created by IntelliJ IDEA.
  User: 聂姜磊
  Date: 2018-08-06
  Time: 9:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>修改</title>
</head>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/sweetalert/sweetalert.css" />
<script type="text/javascript" src="${pageContext.request.contextPath}/static/sweetalert/sweetalert.min.js"></script>
<link rel="stylesheet" href="${pageContext.request.contextPath}/static/bootstrap/css/bootstrap.css"/>

<link rel="stylesheet" href="${pageContext.request.contextPath}/static/table/bootstrap-table.min.css"/>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/table/bootstrap-table.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/table/locale/bootstrap-table-zh-CN.min.js"></script>

<script type="text/javascript" src="${pageContext.request.contextPath}/static/layui/layui.js"></script>
<link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui/css/layui.css"/>
<%--<script src="../../static/laydate/laydate.js" />--%>
<%--<link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/tongyong.css"/>
<link rel="stylesheet" href="${pageContext.request.contextPath}/static/easyui/easyui.css"/>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/easyui/icon.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/easyui/demo.css">
<script type="text/javascript" src="${pageContext.request.contextPath}/static/easyui/jquery.easyui.min.js"></script>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/AmazeUI/css/amazeui.css">
<script type="text/javascript" src="${pageContext.request.contextPath}/static/AmazeUI/js/amazeui.js"></script>--%>
<script type="text/javascript">
    //切换
    $('#myTabs a').click(function (e) {
        e.preventDefault()
        $(this).tab('show')
    })
    $('#myTabs a[href="#profile"]').tab('show') // Select tab by name
    $('#myTabs a:first').tab('show') // Select first tab
    $('#myTabs a:last').tab('show') // Select last tab
    $('#myTabs li:eq(2) a').tab('show') // Select third tab (0-indexed)



//注意：选项卡 依赖 element 模块，否则无法进行功能性操作
    layui.use('element', function(){
        var element = layui.element;

        //…
    });


</script>
<body>
<%--切换--%>

    <!-- Nav tabs -->
   <%-- <ul class="nav nav-tabs" role="tablist">
        <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">参数设置</a></li>
        <li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">小区设置</a></li>
        <li role="presentation"><a href="#ly" aria-controls="profile" role="tab" data-toggle="tab">楼宇设置</a></li>
        <li role="presentation"><a href="#fw" aria-controls="profile" role="tab" data-toggle="tab">房屋设置</a></li>
    </ul>--%>
    <!-- Tab panes -->



    <!-- Nav tabs -->
   <ul class="nav nav-tabs" role="tablist" style="padding-top: 20px;">
         <li role="presentation" class="active"><a href="#fw" aria-controls="fw" role="tab" data-toggle="tab">房屋设置</a></li>
         <li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">小区设置</a></li>
         <li role="presentation"><a href="#ly" aria-controls="profile" role="tab" data-toggle="tab">楼宇设置</a></li>
         <li role="presentation"><a href="#home" aria-controls="profile" role="tab" data-toggle="tab">参数设置</a></li>
     </ul>

    <!-- Tab panes -->
    <div class="tab-content">
        <%--参数设置--%>
        <div role="tabpanel" class="tab-pane" id="home">
            <%--选项卡二--%>
            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief" style="padding-left: 10px;padding-top: 15px;">
                <ul class="layui-tab-title">
                    <li class="layui-this">房屋户型</li>
                    <li>房屋朝向</li>
                </ul>
                <div class="layui-tab-content" style="height: 260px;">
                    <%--1--%>
                    <div class="layui-tab-item layui-show">
                        <script type="text/javascript">
                            $(function(){
                                $("#hxa").bootstrapTable({
                                    url: '${pageContext.request.contextPath}/huxing/hx',
                                    onDblClickRow: function (row, $element, field) {

                                        $("#myModaj").modal("show");

                                        $("#uid").val(row.id);
                                        $("#xgfwhx").val(row.name);
                                    },
                                    columns: [
                                        {
                                            field: 'id',
                                            title: 'id',
                                            visible : false,
                                        },{
                                            field: 'name',
                                            title: '户型'
                                        }, {
                                            field: '删除', title: '操作', formatter: function (value, row, index) {
                                                return "<a onclick='dela(" + row.id + ")' class='glyphicon glyphicon-trash'></a>"
                                            },
                                            cellStyle:{
                                                css:{"width":"15%"}
                                            }
                                        }
                                    ],
                                })
                            })


                            /* 删除*/
                            function dela(aid) {
                                if(confirm("您确定要删除这条通告信息吗？")){

                                    $.post("${pageContext.request.contextPath}/huxing/del", {
                                        "id" : aid
                                    },function (data) {

                                        $("#hxa").bootstrapTable("load",data);

                                    })
                                    alert("删除成功")
                                }else {
                                    alert("你取消的删除！")
                                }

                            }
                            /* 添加*/
                            function save(){
                                var fwhx =$("#fwhx").val();
                                $.post("${pageContext.request.contextPath}/huxing/add",{"name":fwhx},function(data){
                                    $("#hxa").bootstrapTable("load",data);
                                    if(data){
                                        swal("成功！", "你的数据已成功提交！",
                                            "success");
                                    }else{
                                        swal("失败！", "数据提交失败！",
                                            "error");
                                    }
                                });
                            }

                            /*修改*/
                            function upd(){
                                //接收数据

                               var uid= $("#uid").val();
                                var xgfwhx =$("#xgfwhx").val();
                                //alert(name+ "--" + address + "--" + email)  ;
                                //半闭对话框
                                $("#myModal5").modal("show") ;
                                //
                                $.post("${pageContext.request.contextPath}/huxing/upd",{"id":uid,"name":xgfwhx},function(data){
                                    $("#hxa").bootstrapTable("load",data)
                                    if(data){
                                        swal("成功！", "你的数据已成功提交！",
                                            "success");
                                    }else{
                                        swal("失败！", "数据提交失败！",
                                            "error");
                                    }
                                }) ;
                            }
                        </script>
                        <%--添加按钮--%>
                        <div class="layui-btn-group"style="width: 300px;">
                            <button type="button" class="layui-btn" data-toggle="modal" data-target="#myModal4">增加</button>

                        </div>
                        <br>
                        <br>
                        <!-- 添加户型框 -->
                        <div class="modal fade" id="myModal4">
                            <div class="modal-dialog" role="document">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <button type="button" class="close" data-dismiss="modal"
                                                aria-label="Close">
                                            <span aria-hidden="true">&times;</span>
                                        </button>
                                        <h4 class="modal-title" id="myModalLabel4">添加户型</h4>
                                    </div>
                                    <div class="modal-body">
                                        <form>
                                            <div class="form-group">
                                                <label for=>房屋户型:</label> <input type="text" class="form-control" id="fwhx" name="fwhx" placeholder="请输入房屋户型">
                                            </div>
                                        </form>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                            <button onclick="save()" type="button" class="btn btn-primary" data-dismiss="modal">提交</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <!-- 修改户型框 -->
                        <div class="modal fade" id="myModaj">
                            <div class="modal-dialog" role="document">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <button type="button" class="close" data-dismiss="modal"
                                                aria-label="Close">
                                            <span aria-hidden="true">&times;</span>
                                        </button>
                                        <h4 class="modal-title" id="myModalLabe21">修改朝向</h4>
                                    </div>
                                    <div class="modal-body">
                                        <form>
                                            <input type="hidden" class="form-control" id="uid" name="uid" >
                                            <div class="form-group">
                                                <label for=>房屋户型:</label> <input type="text" class="form-control" id="xgfwhx" name="xgfwhx">
                                    </div>
                                        </form>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                            <button onclick="upd()" type="button" class="btn btn-primary" data-dismiss="modal">提交</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <table id="hxa" <%--style="width:500px; "--%>></table>
                    </div>
                        <%--2--%>
                    <div class="layui-tab-item">
                        <script type="text/javascript">
                            $(function(){
                                $("#cx").bootstrapTable({
                                    url: '${pageContext.request.contextPath}/dir/d',
                                    onDblClickRow: function (row, $element, field) {

                                        $("#myModac").modal("show");

                                        $("#did").val(row.id);
                                        $("#xgcxa").val(row.name);
                                    },
                                    columns: [
                                        {
                                            field: 'id',
                                            title: 'id',
                                            visible : false,
                                        },{
                                            field: 'name',
                                            title: '户型'
                                        }, {
                                            field: '删除', title: '操作', formatter: function (value, row, index) {
                                                return "<a onclick='shanchu(" + row.id + ")' class='glyphicon glyphicon-trash'></a>"
                                            },
                                            cellStyle:{
                                                css:{"width":"15%"}
                                            }
                                        }
                                    ],
                                })
                            })


                            /* 删除*/
                            function shanchu(aid) {
                                if(confirm("您确定要删除这条通告信息吗？")){

                                    $.post("${pageContext.request.contextPath}/dir/sc", {
                                        "id" : aid
                                    },function (data) {

                                        $("#cx").bootstrapTable("load",data);

                                    })
                                    alert("删除成功")
                                }else {
                                    alert("你取消的删除！")
                                }

                            }
                            /* 添加*/
                            function add(){
                                var fwcx =$("#fwcx").val();
                                $.post("${pageContext.request.contextPath}/dir/tj",{"name":fwcx},function(data){
                                    $("#cx").bootstrapTable("load",data);
                                    if(data){
                                        swal("成功！", "你的数据已成功提交！",
                                            "success");
                                    }else{
                                        swal("失败！", "数据提交失败！",
                                            "error");
                                    }
                                });
                            }

                            /*修改*/
                            function xiugai(){
                                //接收数据
                                var did =$("#did").val();
                                var xgcxa =$("#xgcxa").val();
                                //alert(name+ "--" + address + "--" + email)  ;
                                //半闭对话框
                                $("#myModal5").modal("show") ;
                                //
                                $.post("${pageContext.request.contextPath}/dir/upda",{"id":did,"name":xgcxa},function(data){
                                    $("#cx").bootstrapTable("load",data)
                                    if(data){
                                        swal("成功！", "你的数据已成功提交！",
                                            "success");
                                    }else{
                                        swal("失败！", "数据提交失败！",
                                            "error");
                                    }
                                }) ;
                            }
                        </script>
                        <%--添加按钮--%>
                        <div class="layui-btn-group"style="width: 300px;">
                            <button type="button" class="layui-btn" data-toggle="modal" data-target="#myModab">增加</button>

                        </div>
                        <br>
                        <br>
                        <!-- 添加房屋朝向 -->
                        <div class="modal fade" id="myModab">
                            <div class="modal-dialog" role="document">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <button type="button" class="close" data-dismiss="modal"
                                                aria-label="Close">
                                            <span aria-hidden="true">&times;</span>
                                        </button>
                                        <h4 class="modal-title" id="myModalLabel8">添加房屋朝向</h4>
                                    </div>
                                    <div class="modal-body">
                                        <form>
                                            <div class="form-group">
                                                <label for=>房屋朝向:</label> <input type="text" class="form-control" id="fwcx" name="fwhx" placeholder="请输入房屋朝向">
                                            </div>
                                        </form>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                            <button onclick="add()" type="button" class="btn btn-primary" data-dismiss="modal">提交</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <table id="cx" <%--style="width:500px; "--%>></table>
                        <!-- 修改户型框 -->
                        <div class="modal fade" id="myModac">
                            <div class="modal-dialog" role="document">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <button type="button" class="close" data-dismiss="modal"
                                                aria-label="Close">
                                            <span aria-hidden="true">&times;</span>
                                        </button>
                                        <h4 class="modal-title" id="myModalLabe20">修改朝向</h4>
                                    </div>
                                    <div class="modal-body">
                                        <form>
                                            <input type="hidden" class="form-control" id="did" name="did" >
                                            <div class="form-group">
                                                <label for=>房屋朝向:</label> <input type="text" class="form-control" id="xgcxa" name="xgcxa">
                                            </div>
                                        </form>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                            <button onclick="xiugai()" type="button" class="btn btn-primary" data-dismiss="modal">提交</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>


        </div>
            <%--小区设置--%>
        <div role="tabpanel" class="tab-pane" id="profile">
                <div class="am-tab-panel" style="height: 750px;">
               <%-- 表格小区设置--%>
                   <script type="text/javascript">
                       $(function(){
                           $("#k").bootstrapTable({
                               url: '${pageContext.request.contextPath}/sale/quanbujianyi',
                               contentType : "application/x-www-form-urlencoded",
                               queryParamsType:'',
                               height:350,
                               pageList:[4,2,15],
                               pageNumber:1,
                               pageSize:4,
                               pagination:true,
                               sidePagination:'server',
                               onDblClickRow: function (row, $element, field) {
                                   $("#myM").modal("show");
                                   $("#pid").val(row.id);
                                   $("#xgxqsl").val(row.name);
                                   $("#xglysl").val(row.danyuan);
                                   $("#xgfwsl").val(row.fang);
                               },
                               columns: [
                                   {
                                       field: 'id',
                                       title: 'id',
                                       visible : false,
                                   },{
                                       field: 'id',
                                       title: '小区编号'
                                   }, {
                                       field: 'name',
                                       title: '小区名称'
                                   },{
                                       field: 'danyuan',
                                       title: '楼宇数量'
                                   },{
                                       field: 'fang',
                                       title: '房屋数量'
                                   },{
                                       field: '删除', title: '操作', formatter: function (value, row, index) {
                                           return "<a onclick='sc(" + row.id + ")' class='glyphicon glyphicon-trash'></a>"
                                       },
                                       cellStyle:{
                                           css:{"width":"15%"}
                                       }
                                   }

                               ],
                           })
                       })


                       /* 删除*/
                       function sc(aid) {
                           if(confirm("您确定要删除这条通告信息吗？")){
                               $.post("${pageContext.request.contextPath}/sale/shanc", {
                                   "id" : aid
                               },function (data) {

                                   $("#k").bootstrapTable("load",data);

                               })
                               alert("删除成功")
                           }else {
                               alert("你取消的删除！")
                           }

                       }
                       /* 添加*/
                       function tianjia(){
                           var xqsl =$("#xqsl").val();
                           var lysl =$("#lysl").val();
                           var fwsl =$("#fwsl").val();
                           //半闭对话框
                           $("#myModal").modal("hide");
                           $.post("${pageContext.request.contextPath}/sale/tianjia",{"name":xqsl,"danyuan":lysl,"fang":fwsl},function(data){
                               $("#k").bootstrapTable("load",data);
                               if(data){
                                   swal("成功！", "你的数据已成功提交！",
                                       "success");
                               }else{
                                   swal("失败！", "数据提交失败！",
                                       "error");
                               }
                           });
                       }

                       /*修改*/
                       function xiug(){
                           //接收数据
                           var pid =$("#pid").val();
                           var xgxqsl =$("#xgxqsl").val();
                           var xglysl =$("#xglysl").val();
                           var xgfwsl =$("#xgfwsl").val();
                           //alert(name+ "--" + address + "--" + email)  ;
                           //半闭对话框
                           $("#myM").modal("hide");
                           //
                           $.post("${pageContext.request.contextPath}/sale/xiugai",{"id":pid,"name":xgxqsl,"danyuan":xglysl,"fang":xgfwsl},function(data){
                               $("#k").bootstrapTable("load",data)
                               if(data){
                                   swal("成功！", "你的数据已成功提交！",
                                       "success");
                               }else{
                                   swal("失败！", "数据提交失败！",
                                       "error");
                               }
                           }) ;
                       }
                   </script>

                   <br>

                  <%-- 添加按钮--%>
                   <div class="layui-btn-group" style="padding-left: 10px;  ">
                       <button type="button" class="layui-btn" data-toggle="modal" data-target="#myModal">增加</button>


                   </div>

                   <br>
                   <br>
                   <!-- 添加模态框 -->
                   <div class="modal fade" id="myModal">
                       <div class="modal-dialog" role="document">
                           <div class="modal-content">
                               <div class="modal-header">
                                   <button type="button" class="close" data-dismiss="modal"
                                           aria-label="Close">
                                       <span aria-hidden="true">&times;</span>
                                   </button>
                                   <h4 class="modal-title" id="myModalLabel">小区信息</h4>
                               </div>
                               <div class="modal-body">
                                   <!-- form开始 -->
                                   <form>
                                       <div class="form-group">
                                           <label for=>小区名称:</label> <input type="text" class="form-control" id="xqsl" placeholder="请输入小区名称">
                                       </div>
                                       <div class="form-group">
                                           <label for=>楼宇数量:</label> <input type="text" class="form-control" id="lysl" placeholder="请输入楼宇数量">
                                       </div>
                                       <div class="form-group">
                                           <label for=>房屋数量:</label> <input type="text" class="form-control" id="fwsl" placeholder="请输入房屋数量">
                                       </div>
                                   </form>
                               </div>
                               <div class="modal-footer">
                                   <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                   <button onclick="tianjia()" type="button" class="btn btn-primary">提交</button>
                               </div>
                           </div>
                       </div>
                   </div>
                   <!-- 修改模态框 -->
                   <div class="modal fade" id="myM">
                       <div class="modal-dialog" role="document">
                           <div class="modal-content">
                               <div class="modal-header">
                                   <button type="button" class="close" data-dismiss="modal"
                                           aria-label="Close">
                                       <span aria-hidden="true">&times;</span>
                                   </button>
                                   <h4 class="modal-title" id="myModalLabel22">修改小区信息</h4>
                               </div>
                               <div class="modal-body">
                                   <!-- form开始 -->
                                   <form>
                                       <input type="hidden" class="form-control" id="pid" name="pid" >
                                       <div class="form-group">
                                           <label for=>小区名称:</label> <input type="text" class="form-control" id="xgxqsl" name="xgxqsl">
                                       </div>
                                       <div class="form-group">
                                           <label for=>楼宇数量:</label> <input type="text" class="form-control" id="xglysl" name="xglysl">
                                       </div>
                                       <div class="form-group">
                                           <label for=>房屋数量:</label> <input type="text" class="form-control" id="xgfwsl" name="xgfwsl">
                                       </div>
                                   </form>
                               </div>
                               <div class="modal-footer">
                                   <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                   <button onclick="xiug()" type="button" class="btn btn-primary">提交</button>
                               </div>
                           </div>
                       </div>
                   </div>
                   <table id="k" ></table>
                   <!-- Tab panes -->

            </div>
        </div>

            <%--楼宇设置--%>
        <div role="tabpanel" class="tab-pane" id="ly">
              <div class="am-tab-panel" style="height: 750px;">
                       <%-- 楼宇设置--%>
                       <script type="text/javascript">
                           $(function(){
                               $("#b").bootstrapTable({
                                   url: '${pageContext.request.contextPath}/danyuan/allq',
                                   contentType : "application/x-www-form-urlencoded",
                                   queryParamsType:'',
                                   height:350,
                                   pageList:[4,2,15],
                                   pageNumber:1,
                                   pageSize:4,
                                   pagination:true,
                                   sidePagination:'server',
                                   onDblClickRow: function (row, $element, field) {
                                       $("#xgmy").modal("show");
                                       $("#bid").val(row.id);
                                       $("#xgssxq").val(row.name);
                                       $("#xglcs").val(row.lou);
                                       $("#xgfws").val(row.fang);
                                   },
                                   columns: [
                                       {
                                           field: 'id',
                                           title: 'id',
                                           visible : false,
                                       },{
                                           field: 'id',
                                           title: '楼宇编号'
                                       },{
                                           field: 'name',
                                           title: '所属小区'
                                       },{
                                           field: 'lou',
                                           title: '楼层数'
                                       },{
                                           field: 'fang',
                                           title: '房屋数'
                                       }, {
                                           field: '删除', title: '操作', formatter: function (value, row, index) {
                                               return "<a onclick='shancs(" + row.id + ")' class='glyphicon glyphicon-trash'></a>"
                                           },
                                           cellStyle:{
                                               css:{"width":"15%"}
                                           }
                                       }
                                   ]
                               })
                           })
                           /* 删除*/
                           function shancs(aid) {
                               if(confirm("您确定要删除这条通告信息吗？")){
                                   $.post("${pageContext.request.contextPath}/danyuan/delq", {
                                       "id" : aid
                                   },function (data) {

                                       $("#b").bootstrapTable("load",data);

                                   })
                                   alert("删除成功")
                               }else {
                                   alert("你取消的删除！")
                               }

                           }
                           /* 添加*/
                           function tianq(){
                               var mc1 =$("#mc1").val();
                               var srdy =$("#srdy").val();
                               var lylcsl =$("#lylcsl").val();
                               //半闭对话框
                               $("#myModal2").modal("hide");
                               $.post("${pageContext.request.contextPath}/danyuan/addqqqq",{"name":mc1,"lou":srdy,"fang":lylcsl},function(data){
                                   $("#b").bootstrapTable("load",data);
                                   if(data){
                                       swal("成功！", "你的数据已成功提交！",
                                           "success");
                                   }else{
                                       swal("失败！", "数据提交失败！",
                                           "error");
                                   }
                               });
                           }

                           /*修改*/
                           function fwxg(){
                               //接收数据
                               var bid =$("#bid").val();
                               var xgssxq =$("#xgssxq").val();
                               var xglcs =$("#xglcs").val();
                               var xgfws =$("#xgfws").val();
                               //alert(name+ "--" + address + "--" + email)  ;
                               //半闭对话框
                               $("#xgmy").modal("hide");
                               //
                               $.post("${pageContext.request.contextPath}/danyuan/updqqqqq",{"id":bid,"name":xgssxq,"lou":xglcs,"fang":xgfws},function(data){
                                   $("#b").bootstrapTable("load",data)
                                   if(data){
                                       swal("成功！", "你的数据已成功提交！",
                                           "success");
                                   }else{
                                       swal("失败！", "数据提交失败！",
                                           "error");
                                   }
                               }) ;
                           }
                       </script>
                       <br>
                       <%-- 添加按钮--%>
                       <div class="layui-btn-group"  style="display: inline-block;width: 100px; padding-left: 10px;">
                           <button type="button" class="layui-btn" data-toggle="modal" data-target="#myModal2">增加</button>
                       </div>
                          <%-- 查询 以及导出--%>
                           <div style="display: inline-block">

                               <div style="display: inline-block">
                              <%--     <button class="layui-btn" type="submit" href="${pageContext.request.contextPath}/a/exportStu-">导出Excel</button>--%>
                                   <a  class="btn btn-primary" href="${pageContext.request.contextPath}/poi/exprotb">导出数据为excel</a>

                               </div>
                           </div>
                        <br>
                       <br>
                       <!-- 添加模态框 -->
                           <div class="modal fade" id="myModal2">
                               <div class="modal-dialog" role="document">
                                   <div class="modal-content">
                                       <div class="modal-header">
                                           <button type="button" class="close" data-dismiss="modal"
                                                   aria-label="Close">
                                               <span aria-hidden="true">&times;</span>
                                           </button>
                                           <h4 class="modal-title" id="myModalLabel2">楼宇信息</h4>
                                       </div>
                                       <div class="modal-body">
                                           <!-- form开始 -->
                                           <form>
                                               <input type="hidden" class="form-control" id="eid" name="eid" >
                                               <div class="form-group">
                                                   <label for=>楼宇名称:</label> <input type="text" class="form-control" id="mc1" name="mc1" placeholder="请输入楼宇名称">
                                               </div>
                                               <div class="form-group">
                                                   <label for="srdy">单元数:</label> <input type="text" class="form-control" id="srdy" name="srdy" placeholder="请输入单元数">
                                               </div>
                                               <div class="form-group">
                                                   <label for=>楼层数:</label> <input type="text" class="form-control" id="lylcsl" name="lylcsl" placeholder="请输入楼层数">
                                               </div>
                                           </form>
                                       </div>
                                       <div class="modal-footer">
                                           <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                           <button onclick="tianq()" type="button" class="btn btn-primary">提交</button>
                                       </div>
                                   </div>
                               </div>
                           </div>




                           <%--修改--%>
                           <!-- 修改模态框 -->
                           <div class="modal fade" id="xgmy">
                               <div class="modal-dialog" role="document">
                                   <div class="modal-content">
                                       <div class="modal-header">
                                           <button type="button" class="close" data-dismiss="modal"
                                                   aria-label="Close">
                                               <span aria-hidden="true">&times;</span>
                                           </button>
                                           <h4 class="modal-title" id="myModalLabel26">修改楼宇信息</h4>
                                       </div>
                                       <div class="modal-body">
                                           <!-- form开始 -->
                                           <form>
                                               <input type="hidden" class="form-control" id="bid" name="bid" >
                                               <div class="form-group">
                                                   <label for=>所属小区:</label> <input type="text" class="form-control" id="xgssxq" name="xgssxq"  placeholder="请输入楼宇名称">
                                               </div>
                                               <div class="form-group">
                                                   <label for=>单元数:</label> <input type="text" class="form-control" id="xglcs" name="xglcs" placeholder="请输入单元数">
                                               </div>
                                               <div class="form-group">
                                                   <label for=>楼层数:</label> <input type="text" class="form-control" id="xgfws" name="xgfws" placeholder="请输入楼层数">
                                               </div>
                                           </form>
                                       </div>
                                       <div class="modal-footer">
                                           <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                           <button onclick="fwxg()" type="button" class="btn btn-primary">提交</button>
                                       </div>
                                   </div>
                               </div>
                           </div>

                       <table id="b" ></table>
                   </div>
        </div>

           <%-- 房屋设置--%>
        <div role="tabpanel" class="tab-pane active" id="fw" >
            <script type="text/javascript">
                $(function(){
                    $("#h").bootstrapTable({
                        url: '${pageContext.request.contextPath}/house/houseAll',
                        contentType : "application/x-www-form-urlencoded",
                        queryParamsType:'',
                        height:550,
                        pageList:[4,2,15],
                        pageNumber:1,
                        pageSize:11,
                        pagination:true,
                        sidePagination:'server',
                        onDblClickRow: function (row, $element, field) {
                            $("#my777").modal("show");
                            $("#mid").val(row.id);
                            $("#xgmpname").val(row.doornumber);
                            $("#xgssld").val(row.sale.id);
                            $("#xgdanyuan").val(row.danyuan.id);
                            $("#xglc").val(row.floor);
                            $("#xgxuan").val(row.huxing.id);
                            $("#xgxuancx").val(row.direction.id);
                            $("#xgfwmj").val(row.measure);
                            $("#xgzhuangtai").val(row.typeb.id);
                            $("#xgbzsr").val(row.remark);


                        },
                        columns: [
                            {
                                field: 'id',
                                title: 'id',
                                visible : false,
                            },{
                                field: 'sale.id',
                                title: 'id',
                                visible : false,
                            },{
                                field: 'danyuan.id',
                                title: 'id',
                                visible : false,
                            },{
                                field: 'huxing.id',
                                title: 'id',
                                visible : false,
                            },{
                                field: 'direction.id',
                                title: 'id',
                                visible : false,
                            },{
                                field: 'typeb.id',
                                title: 'id',
                                visible : false,
                            },{
                                field: 'doornumber',
                                title: '门牌号'
                            },{
                                field: 'sale.name',
                                title: '所属楼栋',
                            },{
                                field: 'danyuan.name',
                                title: '所属单元'
                            },{
                                field: 'floor',
                                title: '所属楼层'
                            },{
                                field: 'huxing.name',
                                title: '房屋户型'
                            },{
                                field: 'direction.name',
                                title: '房屋朝向'
                            },{
                                field: 'measure',
                                title: '房屋面积',
                                formatter: function (value, row, index) {
                                    var jia = row .measure+"平方米";
                                    return jia;
                                }
                            },{
                                field: 'typeb.name',
                                title: '当前状态'
                            },{
                                field: 'remark',
                                title: '备注'
                            }, {
                                field: '删除', title: '操作', formatter: function (value, row, index) {
                                    return "<a onclick='su(" + row.id + ")' class='glyphicon glyphicon-trash'></a>"
                                }}]
                    })

                })
                //按条件查询
                function btn(){
                    var opt = $("#h").bootstrapTable('getOptions') ;
                    var bh = $("#bh").val() ;
                    $.post('${pageContext.request.contextPath}/house/houseAll',{'doornumber':bh,'pageNumber':opt.pageNumber,'pageSize':opt.pageSize},function(data){
                        //重新给table绑定数据5
                        $("#h").bootstrapTable("load",data) ;
                    });
                }
                /* 删除*/
                function su(aid) {
                    if(confirm("您确定要删除这条通告信息吗？")){
                        $.post("${pageContext.request.contextPath}/house/fwdel", {
                            "id" : aid
                        },function (data) {

                            $("#h").bootstrapTable("load",data);

                        })
                        alert("删除成功")
                    }else {
                        alert("你取消的删除！")
                    }

                }

                /* 添加*/
                function ghtadd(){
                    var mpname =$("#mpname").val(); //门牌号
                    var ssld =$("#ssld").val(); //所属楼栋
                    var danyuan =$("#danyuan").val(); //所属单元
                    var lc =$("#lc").val(); //所属楼层
                    var xuan =$("#xuan").val(); //房屋户型
                    var xuancx =$("#xuancx").val(); //房屋朝向
                    var fwmj =$("#fwmj").val(); //房屋面积
                    var zhuangtai =$("#zhuangtai").val(); //当前状态

                    var szt = zhuangtai;

                /*    console.log(zhuangtai);
*/
                    var bzsr =$("#bzsr").val(); //备注
                    if(mpname==""){
                        sweetAlert("门牌号不能为空","请输入门牌号","error")
                    }else if(ssld==""){
                        sweetAlert("楼栋不能为空","请选择楼栋","error")
                    }else if(danyuan==""){
                        sweetAlert("单元不能为空","请选择单元","error")
                    }else if(lc==""){
                        sweetAlert("楼层不能为空","请输入楼层","error")
                    }else if(xuan==""){
                        sweetAlert("户型不能为空","请选择户型","error")
                    }else if(xuancx==""){
                        sweetAlert("朝向不能为空","请选择朝向","error")
                    }else if(fwmj==""){
                        sweetAlert("房屋面积不能为空","请输入房屋面积","error")
                    }else if(zhuangtai=""){
                        sweetAlert("当前状态不能为空","请选择当前状态","error")
                    }


                    $.post("${pageContext.request.contextPath}/house/tianjiaadd",{"doornumber":mpname,"sale.id":ssld,"danyuan.id":danyuan,"floor":lc,"huxing.id":xuan,"direction.id":xuancx,"measure":fwmj,"typeb.id":szt,"remark":bzsr,},function(data){
                        $("#h").bootstrapTable("load",data);
                        //半闭对话框
                        $("#my666").modal("hide");
                        if(data){
                            swal("成功！", "你的数据已成功提交！",
                                "success");
                        }else{
                            swal("失败！", "数据提交失败！",
                                "error");
                        }
                    });
                }
                /*修改*/
                function xiugod(){
                    //接收数据
                    var mid =$("#mid").val();
                    var xgmpname =$("#xgmpname").val();
                    var xgssld =$("#xgssld").val();
                    var xgdanyuan =$("#xgdanyuan").val();
                    var xglc =$("#xglc").val();
                    var xgxuan =$("#xgxuan").val();
                    var xgxuancx =$("#xgxuancx").val();
                    var xgfwmj =$("#xgfwmj").val();
                    var xgzhuangtai =$("#xgzhuangtai").val();
                    var xgbzsr =$("#xgbzsr").val();
                    //alert(name+ "--" + address + "--" + email)  ;
                    //半闭对话框
                    $("#my777").modal("hide");
                    //
                    $.post("${pageContext.request.contextPath}/house/updxg",{"id":mid,"doornumber":xgmpname,"sale.id":xgssld,"danyuan.id":xgdanyuan,"floor":xglc,"huxing.id":xgxuan,"direction.id":xgxuancx,"measure":xgfwmj,"typeb.id":xgzhuangtai,"remark":xgbzsr},function(data){
                        $("#h").bootstrapTable("load",data)
                        if(data){
                            swal("成功！", "你的数据已成功提交！",
                                "success");
                        }else{
                            swal("失败！", "数据提交失败！",
                                "error");
                        }
                    }) ;
                }
            </script>
            <br>

            <%-- 添加按钮--%>
            <div class="layui-btn-group"style="width: 100px; padding-left: 10px">
                <button type="button" class="layui-btn" data-toggle="modal" data-target="#my666">增加</button>

            </div>
            <%--房屋--%>

            <div style="display: inline-block">
                <span style="font-size: 15px;font-family: 微软雅黑">门牌编号:</span>
                <div style="display: inline-block">
                    <input type="text" class="layui-input" id="bh" name="bh" placeholder="请输入门牌号">
                </div>&nbsp;&nbsp;&nbsp;
                <div style="display: inline-block">
                    <button class="layui-btn" onclick="btn()" type="button">查询</button>
                </div>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <div style="display: inline-block">
                   <%-- <button class="layui-btn"  type="submit" >导出Excel</button>--%>
                       <a  class="btn btn-primary" href="${pageContext.request.contextPath}/poi/exportStu">导出数据为excel</a>
                  <%--     &nbsp;&nbsp;&nbsp;
                       <a  class="btn btn-primary" >导出数据为excel</a>
                    <input class="btn btn-primary" type="button" onclick="window.print()" value="打印">--%>
                </div>
            </div>
            <br>
            <br>
            <!-- 添加模态框 -->
            <div class="modal fade" id="my666">
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal"
                                    aria-label="Close">
                                <span aria-hidden="true">&times;</span>
                            </button>
                            <h4 class="modal-title" id="myModalLabel3">房屋信息</h4>
                        </div>
                        <div class="modal-body">
                            <!-- form开始 -->
                            <form>
                                <div style="width: 100%;height: 300px; text-align: left" id="shang">
                                    <div style="padding-bottom: 5px;padding-right: 5px;display: inline-block"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        门牌号:
                                        <div style="width: 180px;display: inline-block">
                                            <input type="text" class="form-control" id="mpname" name="mpname" <%--disabled--%> placeholder="请输入门牌号">
                                        </div>
                                    </div>
                                    <div style="padding-bottom: 5px;padding-right: 5px;display: inline-block"> &nbsp;&nbsp;
                                        所属楼栋:
                                        <div style="width: 180px;display: inline-block">
                                            <select id="ssld" name="ssld" class="form-control">
                                                <option value="-1">请选择所属楼栋</option>
                                            </select>
                                        </div>
                                    </div>
                                    <br>
                                    <br>
                                    <div style="padding-bottom: 5px;padding-right: 5px;display: inline-block"> &nbsp;&nbsp;
                                        所属单元:
                                        <div style="width: 180px;display: inline-block">
                                            <select id="danyuan" name="danyuan" class="form-control">
                                                <option value="-1">请选择所属单元</option>
                                            </select>
                                        </div>
                                    </div>
                                  <%--  <div style="padding-bottom: 5px;padding-right: 5px;display: inline-block"> &nbsp;&nbsp;
                                        所属单元:

                                            <select id="danyuan" name="danyuan"  class="form-control">
                                                <option value="-1">请选择所属单元</option>
                                            </select>

                                    </div>--%>
                                    <div style="padding-bottom: 5px;padding-right: 5px;display: inline-block"> &nbsp;&nbsp;
                                        所属楼层:
                                        <div style="width: 180px;display: inline-block">
                                            <input type="text" class="form-control" id="lc" name="lc" placeholder="请输入所属楼层">
                                        </div>
                                    </div>
                                    <br>
                                    <br>
                                    <div style="padding-bottom: 5px;padding-right: 5px;display: inline-block"> &nbsp;&nbsp;
                                        房屋户型:
                                        <div style="width: 180px;display: inline-block">
                                            <select id="xuan" name="xuan"  class="form-control">
                                                <option value="-1">请选择房屋户型</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div style="padding-bottom: 5px;padding-right: 5px;display: inline-block"> &nbsp;&nbsp;
                                        房屋朝向:
                                        <div style="width: 180px;display: inline-block">
                                            <select id="xuancx" name="xuancx" class="form-control">
                                                <option value="-1">请选择房屋朝向</option>
                                            </select>
                                        </div>
                                    </div>
                                    <br>
                                    <br>
                                    <div style="padding-bottom: 5px;padding-right: 5px;display: inline-block"> &nbsp;&nbsp;
                                        房屋面积:
                                        <div style="width: 180px;display: inline-block">
                                            <input type="text" class="form-control" id="fwmj" name="fwmj" placeholder="请输入房屋面积">
                                        </div>
                                    </div>
                                    <div style="padding-bottom: 5px;padding-right: 5px;display: inline-block"> &nbsp;&nbsp;
                                        当前状态:
                                        <div style="width: 180px;display: inline-block">
                                            <select id="zhuangtai" name="zhuangtai" class="form-control">
                                                <option value="-1">请选择当前状态</option>
                                            </select>
                                        </div>
                                    </div>
                                    <br>
                                    <br>
                                    <div style="padding-bottom: 5px;padding-right: 5px;display: inline-block"> &nbsp;&nbsp;
                                        备&emsp;&emsp;注:
                                        <div style="width: 180px;display: inline-block">
                                            <input type="text" class="form-control" id="bzsr" name="bzsr" placeholder="请输入备注">
                                        </div>
                                    </div>
                                </div>
<%--

                                <div class="modal-footer">
                                    <button type="button" id="ddd" onclick="ti1()" class="btn btn-primary">确认</button>
                                </div>
--%>
                            </form>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                            <button onclick="ghtadd()" type="button" class="btn btn-primary">提交</button>
                        </div>
                    </div>
                </div>
            </div>


            <!-- 修改模态框 -->
            <div class="modal fade" id="my777">
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal"
                                    aria-label="Close">
                                <span aria-hidden="true">&times;</span>
                            </button>
                            <h4 class="modal-title" id="myModalLabe85">修改房屋信息</h4>
                        </div>
                        <div class="modal-body">
                            <!-- form开始 -->
                            <form>
                                <div style="width: 100%;height: 300px; text-align: left" id="ate">
                                    <input type="hidden" class="form-control" id="mid" name="mid" >
                                    <div style="padding-bottom: 5px;padding-right: 5px;display: inline-block"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        门牌号:
                                        <div style="width: 180px;display: inline-block">
                                            <input type="text" class="form-control" id="xgmpname"  name="xgmpname" disabled >
                                        </div>
                                    </div>
                                    <div style="padding-bottom: 5px;padding-right: 5px;display: inline-block"> &nbsp;&nbsp;
                                        所属楼栋:
                                        <div style="width: 180px;display: inline-block">
                                            <select id="xgssld" name="xgssld" class="form-control">
                                                <option value="-1">请选择</option>
                                                <option value="1">一号楼</option>
                                                <option value="2">二号楼</option>
                                                <option value="3">21</option>
                                            </select>
                                        </div>
                                    </div>
                                    <br>
                                    <br>
                                    <div style="padding-bottom: 5px;padding-right: 5px;display: inline-block"> &nbsp;&nbsp;
                                        所属单元:
                                        <div style="width: 180px;display: inline-block">
                                            <select id="xgdanyuan" name="xgdanyuan" class="form-control">
                                                <option value="-1">请选择</option>
                                                <option value="1">一单元1</option>
                                                <option value="2">一单元1</option>
                                                <option value="3">一单元2</option>
                                                <option value="4">二单元2</option>


                                            </select>
                                        </div>
                                    </div>
                                    <%--  <div style="padding-bottom: 5px;padding-right: 5px;display: inline-block"> &nbsp;&nbsp;
                                          所属单元:

                                              <select id="danyuan" name="danyuan"  class="form-control">
                                                  <option value="-1">请选择所属单元</option>
                                              </select>

                                      </div>--%>
                                    <div style="padding-bottom: 5px;padding-right: 5px;display: inline-block"> &nbsp;&nbsp;
                                        所属楼层:
                                        <div style="width: 180px;display: inline-block">
                                            <input type="text" class="form-control" id="xglc" name="xglc">
                                        </div>
                                    </div>
                                    <br>
                                    <br>
                                    <div style="padding-bottom: 5px;padding-right: 5px;display: inline-block"> &nbsp;&nbsp;
                                        房屋户型:
                                        <div style="width: 180px;display: inline-block">
                                            <select id="xgxuan" name="xgxuan"  class="form-control">
                                                <option value="-1">请选择</option>
                                                <option value="1">两室一厅</option>
                                                <option value="2">三室两厅</option>
                                                <option value="3">一室一厅</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div style="padding-bottom: 5px;padding-right: 5px;display: inline-block"> &nbsp;&nbsp;
                                        房屋朝向:
                                        <div style="width: 180px;display: inline-block">
                                            <select id="xgxuancx" name="xgxuancx" class="form-control">
                                                <option value="-1">请选择</option>
                                                <option value="1">朝东</option>
                                                <option value="2">朝北</option>
                                                <option value="3">朝南</option>
                                                <option value="4">朝西</option>

                                            </select>
                                        </div>
                                    </div>
                                    <br>
                                    <br>
                                    <div style="padding-bottom: 5px;padding-right: 5px;display: inline-block"> &nbsp;&nbsp;
                                        房屋面积:
                                        <div style="width: 180px;display: inline-block">
                                            <input type="text" class="form-control" id="xgfwmj" name="xgfwmj" placeholder="请输入房屋面积">
                                        </div>
                                    </div>
                                    <div style="padding-bottom: 5px;padding-right: 5px;display: inline-block"> &nbsp;&nbsp;
                                        当前状态:
                                        <div style="width: 180px;display: inline-block">
                                            <select id="xgzhuangtai" name="xgzhuangtai" class="form-control" disabled>
                                                <option value="-1">请选择</option>
                                                <option value="1">空闲</option>
                                                <option value="2">已售</option>
                                            </select>
                                        </div>
                                    </div>
                                    <br>
                                    <br>
                                    <div style="padding-bottom: 5px;padding-right: 5px;display: inline-block"> &nbsp;&nbsp;
                                        备&emsp;&emsp;注:
                                        <div style="width: 180px;display: inline-block">
                                            <input type="text" class="form-control" id="xgbzsr" name="xgbzsr" placeholder="请输入备注">
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                            <button onclick="xiugod()" type="button" class="btn btn-primary">提交</button>
                        </div>
                    </div>
                </div>
            </div>
            <table id="h" ></table>

        </div>
    </div>

</body>
<script type="text/javascript">
    $(function(){
        //异步查询房屋户型下拉框
        $.post("${pageContext.request.contextPath}/huxing/hx",function (releset) {
            var e=releset;
            $(e).each(function (i,e) {
                $('#xuan').append('<option value='+e.id+' >'+e.name+'</option>');
            })
        })
        //异步查询房屋朝向下拉框
        $.post("${pageContext.request.contextPath}/dir/d",function (releset) {
            var e=releset;
            $(e).each(function (i,e) {
                $('#xuancx').append('<option value='+e.id+' >'+e.name+'</option>');
            })
        })
        //异步查询当前状态下拉框
        $.post("${pageContext.request.contextPath}/typeb/all",function (releset) {
            var e=releset;
            $(e).each(function (i,e) {
                $('#zhuangtai').append('<option value='+e.id+' >'+e.name+'</option>');
            })
        })
        //异步查询当前楼栋下拉框
        $.post("${pageContext.request.contextPath}/sale/ld",function (releset) {
            var e=releset;
            $(e).each(function (i,e) {
                $('#ssld').append('<option value='+e.id+' >'+e.name+'</option>');
            })
        })
        //异步查询当前单元下拉框
        $.post("${pageContext.request.contextPath}/danyuan/danlist",function (releset) {
            var e=releset;
            $(e).each(function (i,e) {
                $('#danyuan').append('<option value='+e.id+' >'+e.name+'</option>');
            })
        })
    })
</script>
</html>
